﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZipAndUnzipDemo
{
    class Program
    {
        public static void Main(string[] args)
        {
            //string srcFile = @"testzip";//准备压缩的文件路径
            //string zipFile = @"testzip";//压缩后的文件路径
            //string unzipFile = @"testzip_unzip";//解压后的文件路径
            //Console.WriteLine("使用BZIP开始压缩文件……");

            //if (ZipAndUnzipFile.BZipFile(srcFile, zipFile + ".bz"))
            //{
            //    Console.WriteLine("文件压缩完成");
            //} 
            //else
            //{
            //    Console.WriteLine("文件压缩失败");
            //}

            // 压缩文件夹
            //string[] FileProperties = new string[2];
            //FileProperties[0] = "D:\\unzipped\\";
            //FileProperties[1] = "D:\\zip\\b.zip";
            //ZipAndUnzipFile.ZipFile(FileProperties[0], FileProperties[1]);

            // 解压文件夹
            //string[] FileProperties = new string[2];
            //FileProperties[0] = "D:\\zip\\b.zip";
            //FileProperties[1] = "D:\\unzipped";
            //ZipAndUnzipFile.unZipFile(FileProperties[0], FileProperties[1]);

            //压缩文件夹
            //string[] FileProperties = new string[2];
            //FileProperties[0] = "D:\\upload\\uploading\\MY_SL_TKT_20190802.txt";
            //FileProperties[0] = "D:\\upload\\uploading\\";
            //FileProperties[1] = "D:\\upload\\zip\\MY_SL_TKT_20190802.zip";
            //ZipAndUnzipFile.ZipFileByPassword(FileProperties[0], FileProperties[1],"123456");
            //Console.WriteLine("hello world!");


            string[] FileProperties = new string[2];
            string textName = "MY_SL_TKT_20190801.txt";
            string strFile = "D:\\upload\\uploading\\MY_SL_TKT_20190802.txt";
            string strZip = "D:\\upload\\zip\\MY_SL_TKT_20190802.zip";
            ZipAndUnzipFile.ZipFileByPassword(strFile, strZip, textName, "123456");
            Console.WriteLine("hello world!");
        }
    }
}
